UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '24Yn1QbxqS+TzNhPvAAhahgwlqrF6UO8FfGrf2vhVdQ=' 
WHERE 
  key_id = '96c46a9f5d72d0413cf32f8321b4765fdbde407e3ae0932e99de089766819de6' 
  AND (
    token = '24Yn1QbxqS+TzNhPvAAhahgwlqrF6UO8FfGrf2vhVdQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043