UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'C7oXp6P7RmRp1eW9eNP19K7wl+aaIrl/rbmq5hHY6Ts=' 
WHERE 
  key_id = 'f283c8645c1f20786f328862a8d37da41a6463d2091cfb36c51cafcfffcb5ab6' 
  AND (
    token = 'C7oXp6P7RmRp1eW9eNP19K7wl+aaIrl/rbmq5hHY6Ts=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021