UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fn7xK7VjfixThL874q8+53W9BWoj5nAHJTiJKKA0Vqk=' 
WHERE 
  key_id = 'b7907b6915188f20b669238faa538fd127815862dea82dc05245b9e1d6baff4d' 
  AND (
    token = 'fn7xK7VjfixThL874q8+53W9BWoj5nAHJTiJKKA0Vqk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035