UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ufXCdHxK+5wF6wFMEU13sYd6sPf8dcSbKqsXMOPHqqI=' 
WHERE 
  key_id = 'b8df9467e3f8fcca1bec91d5535ca1a7571100a977d0bddc9f8e47eb6ba1cae5' 
  AND (
    token = 'ufXCdHxK+5wF6wFMEU13sYd6sPf8dcSbKqsXMOPHqqI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032