UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BzDrflYIUM+GoXh6tP3FjJwsr0LsaUDpir4pBk4q98Y=' 
WHERE 
  key_id = '8298b633e02119413ace3c83b149adba4b4a26600022631c05acce5b6fe65131' 
  AND (
    token = 'BzDrflYIUM+GoXh6tP3FjJwsr0LsaUDpir4pBk4q98Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036