UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'clvaNEI3wEVnthbzjTlltZ04OL31gTyjMQ/FYJWdqIY=' 
WHERE 
  key_id = '22e1504967ad705418a19fd699e7a6ac6ca345e798f3d9aaeb84fb661b33a9c8' 
  AND (
    token = 'clvaNEI3wEVnthbzjTlltZ04OL31gTyjMQ/FYJWdqIY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00056