UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BHKzta1SALgeaJtekSrkkv4ZSMiIEWgbyy/QGRAAsms=' 
WHERE 
  key_id = 'd5406dcdea8b3da383a0f2554e44dbe01ba322956d5d8c97719c14de124fc5b9' 
  AND (
    token = 'BHKzta1SALgeaJtekSrkkv4ZSMiIEWgbyy/QGRAAsms=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036