UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BrC0e2Sxv+wU7wwk/DYgpKwsrutjNJ9BbxV9eN5nGSY=' 
WHERE 
  key_id = 'b581d65eb894f58eb5ce9e6a9c4df579f19492f46b670e2de5d746da7a0d8866' 
  AND (
    token = 'BrC0e2Sxv+wU7wwk/DYgpKwsrutjNJ9BbxV9eN5nGSY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050