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

Query time 0.00051