UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Z5VclJ5RAoF9hYs4mblX2+SP4o/UKVEruozMRpWwYJc=' 
WHERE 
  key_id = '7cda24f528f8189e0192080a3a9f4f2cc35145ef88b529cbf440d9c9a6db5a24' 
  AND (
    token = 'Z5VclJ5RAoF9hYs4mblX2+SP4o/UKVEruozMRpWwYJc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032