UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZFQWbGyv19AAV1QBO+mE8YeQvoMjsdmzfHuqtf6Wz2k=' 
WHERE 
  key_id = '0d5d2f27a6c11287a73c7ca4874f9c11df83858fd20c5d32e368afaade2391b0' 
  AND (
    token = 'ZFQWbGyv19AAV1QBO+mE8YeQvoMjsdmzfHuqtf6Wz2k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035