UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5YB31Nt0Dw4UCckbh8hEmgVlL/DAs46YXT1J3R3/s/4=' 
WHERE 
  key_id = 'a527255c4cfafff0cfc197887d2d3f2fd427cb7dc24bf10729b0cbb1312c6b5c' 
  AND (
    token = '5YB31Nt0Dw4UCckbh8hEmgVlL/DAs46YXT1J3R3/s/4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034