UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZYCK/Xig30W7FFbn7kSObPSFUe9GNN1c8+PQGAi1ecs=' 
WHERE 
  key_id = '6a0bbb3146cf13971103229a19b9d0b4e9c473d5626215606e0e22f4d56dba52' 
  AND (
    token = 'ZYCK/Xig30W7FFbn7kSObPSFUe9GNN1c8+PQGAi1ecs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037