UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'b1Ld1vAzkL4TeqPG3c/W3xY+PJ7MoqzYN9g52tZTG5U=' 
WHERE 
  key_id = 'dbde8170357073c8033e5e7dd656987f44d4a813290ea992653a597bd725de89' 
  AND (
    token = 'b1Ld1vAzkL4TeqPG3c/W3xY+PJ7MoqzYN9g52tZTG5U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027