UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jT1HZ7J0q2kpe4CdZ/bAYWuBbKtMwcnZl8zv30GmWvc=' 
WHERE 
  key_id = 'c570cd8666e79aef5fe862cbe736876bd771561b103b469330414f863ccf5b42' 
  AND (
    token = 'jT1HZ7J0q2kpe4CdZ/bAYWuBbKtMwcnZl8zv30GmWvc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033