UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4LdZQXi4e0yq4DjnN21ZrbLVbIkdU3hiTrcz1ps+LtQ=' 
WHERE 
  key_id = 'd1bb52b26c143cd4ed831d6b42c3623d8bec8fb13d27f8cb7e12585a243d333e' 
  AND (
    token = '4LdZQXi4e0yq4DjnN21ZrbLVbIkdU3hiTrcz1ps+LtQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050