UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MUOtRP/nQmMSENFCOTzN3Kq/nvqEn76Ac6IAtqtEbz8=' 
WHERE 
  key_id = '640b3d197c41957615d81718b8f05a6c6d95a558dcac89186a081509ed8de3e8' 
  AND (
    token = 'MUOtRP/nQmMSENFCOTzN3Kq/nvqEn76Ac6IAtqtEbz8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020