UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dmfMKbOrcARGgvuEVCRR4u6o5jUDkex0Zl1cOflLU1M=' 
WHERE 
  key_id = '1039ccc466ddd7f0f2189288d7cc4044f20e2ed85e4c08f34fe6c236a77e00b3' 
  AND (
    token = 'dmfMKbOrcARGgvuEVCRR4u6o5jUDkex0Zl1cOflLU1M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035