UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'U2ZerrHI1qT3NWYwrD4UFmZEsZgtCXndf3ftLiUG66o=' 
WHERE 
  key_id = '4147d27b74c2db46bc8e1e55ea92f0147b9c8f1bc5ba42c52a15532fa74981cb' 
  AND (
    token = 'U2ZerrHI1qT3NWYwrD4UFmZEsZgtCXndf3ftLiUG66o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038