UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Tyfl05VE5cFqN2+RfXcKenAnC7TH+oBESTQcWpyIkzE=' 
WHERE 
  key_id = '3ac301ec0f5ef7d7fd8a217490618cc662871bc5d2fc7903990608d13365a130' 
  AND (
    token = 'Tyfl05VE5cFqN2+RfXcKenAnC7TH+oBESTQcWpyIkzE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039