UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QJf8bdal7zwVRQBLRfhS9Wl4aXoZEdl3xqQg+1ubrtE=' 
WHERE 
  key_id = '819404a0c0720164d34171890c4f6f16dbfd6d42c233ad76d162d859c4f7ee8a' 
  AND (
    token = 'QJf8bdal7zwVRQBLRfhS9Wl4aXoZEdl3xqQg+1ubrtE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051