UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8BEvN1n/FrmqswfRWUUHksqZyaD/8lO6ZQxj524os+Q=' 
WHERE 
  key_id = '885892da0154094f2153f5f7660a9150652d7d52dd53dc4187d5bb188f8084f1' 
  AND (
    token = '8BEvN1n/FrmqswfRWUUHksqZyaD/8lO6ZQxj524os+Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048