UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RI5lN5/5N14xkQk3JOKLqvpUTq56kjJU1cZ7MzVPcqw=' 
WHERE 
  key_id = '15a6f4e8fdcbcd3172e89d814de78c2f687bcac21f4b9cab1817edced446ca66' 
  AND (
    token = 'RI5lN5/5N14xkQk3JOKLqvpUTq56kjJU1cZ7MzVPcqw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044