UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UB655fJ+p24NdvlPeh4ueosCkM7W5pitG820QpogBVE=' 
WHERE 
  key_id = 'd1983a5b19ae6611c11673f0a54717a0e1afd4f328e41629250734377331b0ce' 
  AND (
    token = 'UB655fJ+p24NdvlPeh4ueosCkM7W5pitG820QpogBVE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00057