UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'epztEdeb6E3AEMt4V1UWuvLoAMcG71EL71a9EVSkWGk=' 
WHERE 
  key_id = 'e9c45f60ec16f03de795d4037a30d1d2297c789ab519f4576c2486ce057979f3' 
  AND (
    token = 'epztEdeb6E3AEMt4V1UWuvLoAMcG71EL71a9EVSkWGk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026