UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eCjdCg7IpcZciq0Qw4OvfXAvWH+4scfaPS9lQPfeXoI=' 
WHERE 
  key_id = 'f51c5b358c01da5c3fe7fac258adf88f9c1c060a51621b14ff92ad0a474761bc' 
  AND (
    token = 'eCjdCg7IpcZciq0Qw4OvfXAvWH+4scfaPS9lQPfeXoI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027