UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'f5SWYRgsIx/C/TqZMPKV/NQiJuWG61f+xJS/WRYuu+o=' 
WHERE 
  key_id = 'df27999aae52e45b3e76005b7864b124d0149c795cbf3b87cdb6bb1087bda504' 
  AND (
    token = 'f5SWYRgsIx/C/TqZMPKV/NQiJuWG61f+xJS/WRYuu+o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023