UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'w8NA6WSs/RjnWvLnzuRcrlBQW5Y/vg4evmq/ZFYFYxY=' 
WHERE 
  key_id = '5297c04665bb7859834d63aa2ce4218692fff53c5dc0c7f04d7ba49469847e29' 
  AND (
    token = 'w8NA6WSs/RjnWvLnzuRcrlBQW5Y/vg4evmq/ZFYFYxY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019